package org.come.tt;

import com.tool.btn.MoBanBtn;
import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;
import org.come.Frame.ShoppingBuyJframe;
import org.come.Frame.ZhuFrame;
import org.come.bean.LoginResult;
import org.come.model.Shop;
import org.come.npc.TP;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.FormsManagement;
import org.come.until.Music;
import org.come.until.UserMessUntil;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.List;

/**
 * 天梯
 *
 * @author Administrator
 */
public class LadderPanelBtn extends MoBanBtn {
    private int num;

    public LadderPanelBtn(String iconpath, int type, int num) {
        // TODO Auto-generated constructor stub
        super(iconpath, type);
        this.num = num;
    }
    public LadderPanelBtn(String iconpath, int type, String text, Color[] colors, Font font, int num) {
        // TODO Auto-generated constructor stub
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.num = num;
    }
    @Override
    public void chooseyes() {

    }

    /**
     * 判断属于哪个按钮点击调用不同的方法
     */
    public void btnjt() {
        // TODO Auto-generated method stub

    }

    @Override
    public void chooseno() {
        btnjt();
    }


    private void enterTheLadder() {
        String[] v = ImageMixDeal.userimg.getTeams();
        if (v != null) {
            int palSum = 0;
            LoginResult login = RoleData.getRoleData().getLoginResult();
            if (login.getPals() != null && !login.getPals().equals("")) {
                palSum = login.getPals().split("\\|").length;
            }
            if (v.length + palSum < 5) {
                ZhuFrame.getZhuJpanel().addPrompt2("队伍人数不够" + 5 + "个人,先凑齐人数在来吧");
                return;
            }
        }
    }

    @Override
    public void nochoose(MouseEvent e) {
        String sendmes;
        switch (num) {
            //匹配天梯
            case 1:
                TP.tp(TP.scdoor("4444", 840, 500), 5); // 自定义天梯地图
                FormsManagement.HideForm(604);

//                String sendmes = Agreement.getAgreement().laddArenaAgreement("O");
//                SendMessageUntil.toServer(sendmes);
//                SendMessageUntil.toServer(Agreement.getAgreement().gangbattle(29+"|"));
                break;
            //积分兑换
            case 2:

                List<Shop> npcshop = UserMessUntil.getNpcshop().getNpcShopMap().get("2029");
                ShoppingBuyJframe.getShoppingBuyJframe().getShoppingBuyJpanel().showshop(npcshop, "2029", null);
                FormsManagement.showForm(23);

//                    new NpcShop().menuControl("天梯兑换");
//                    MapAction.npcmenuAction.get("菜单").menuControl("我来换点竞技物品");
//                    ShoppingBuyJframe.getShoppingBuyJframe().getShoppingBuyJpanel().showshop(npcshop4, npctype4, null);
                break;
            //奖励1
            case 3:
                sendmes = Agreement.getAgreement().laddArenaAgreement("7");
                SendMessageUntil.toServer(sendmes);
                break;
//                LadderLotteryJframe.getLadderLotteryJframe().getLadderLotteryJpanel().getlotteryTypeGoods(6);
//                FormsManagement.showForm(606);
////                    // 打开了窗体
////                    String sendMes = Agreement.getFiveMsgAgreement("CC6" + type);
////                    SendMessageUntil.toServer(sendMes);
//                Music.addyinxiao("开关窗口.mp3");
//                FormsManagement.HideForm(605);
//                break;
            //奖励1
            case 4:
                sendmes = Agreement.getAgreement().laddArenaAgreement("4");
                SendMessageUntil.toServer(sendmes);
                break;
            //奖励2
            case 5:
                sendmes = Agreement.getAgreement().laddArenaAgreement("5");
                SendMessageUntil.toServer(sendmes);
                break;
            //奖励3
            case 6:
                sendmes = Agreement.getAgreement().laddArenaAgreement("6");
                SendMessageUntil.toServer(sendmes);
                break;
            case 10:
                FormsManagement.HideForm(3100);
                FormsManagement.showForm(624);
                break;
        }

    }


}
